package com.nsn.auction.dao.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.nsn.auction.dao.AuctionDao;
import com.nsn.auction.domina.Auction;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class AuctionDaoImpl extends CustomHibernateDaoSupport implements AuctionDao {

	@Override
	public void save(Auction auction) {
		getHibernateTemplate().save(auction);

	}

	@Override
	public void update(Auction auction) {
		getHibernateTemplate().update(auction);

	}

	@Override
	public void delete(Auction auction) {
		getHibernateTemplate().delete(auction);

	}

	@Override
	public Auction findAuctionByAuctionId(Long auctionId) {
		List<Auction> list = getHibernateTemplate().find("from Auction where auctionId=?", auctionId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}

}
